ci(release): token auth + idempotent publish, fix the red pypi deployment (#564)#567
Merged
Merged
Conversation
The OIDC Trusted Publisher path needs a one-time PyPI configuration that hasn't yet been performed (per #564); meanwhile every release fires a deployment to the `pypi` environment that fails with `invalid-publisher`, so the repo widget paints red even when v1.0.x is actually live on PyPI. Switch the workflow to the maintainer's working path — the same token in `./.env` (`POETRY_PYPI_TOKEN_PYPI`) stored as `PYPI_API_TOKEN` in repo secrets — and add an idempotency guard so the job is also a no-op (still green) when the version has already been published manually. - Token-based auth via `pypa/gh-action-pypi-publish` `password:` input. No `id-token: write` permission needed any more. - `Is this version already on PyPI?` step queries `pypi.org/pypi/<pkg>/<version>/json`; if the version is already live the upload step is skipped. Defense-in-depth: `skip-existing: true` on the publish step still handles a race past the guard. - Header rewritten: owner-setup section now documents the `PYPI_API_TOKEN` repo-secret requirement (one-time copy from `.env`). - TestPyPI mirror gets the same treatment via `TESTPYPI_API_TOKEN`. Trusted Publishing remains the longer-term goal (#564) — when the PyPI Trusted Publisher is finally configured we can revert to the OIDC variant in a single commit. Until then, this gets the deployment widget green on every tag and ends the manual-only release path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 28, 2026
MartinCastroAlvarez
added a commit
that referenced
this pull request
May 28, 2026
Reverts the auth change from #567 (back to OIDC Trusted Publishing) while keeping the idempotency guard that actually fixes the red Deployments widget. No GitHub Secret needed; no long-lived token stored anywhere.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The repo's Deployments widget shows the `pypi` environment as failed even though django-admin-react 1.0.0 and 1.0.1 are both live on PyPI:
Change
Switch `release.yml` to token-based auth (the same path the maintainer uses locally) and make the publish step idempotent:
Trusted Publishing remains the longer-term goal — when #564 is finally configured on PyPI's side we can revert to the OIDC variant in a single commit. This patch unblocks today.
One-time owner step
After merge, add the PyPI token to repo secrets so the workflow can actually upload:
Once the secret is present, every future `v*` Release tag will:
Re-running for v1.0.1
After merging + adding the secret, you can also re-trigger the v1.0.1 deployment by re-running the failed Actions run (Actions → "release" → the v1.0.1 run → Re-run all jobs). The idempotency guard will detect 1.0.1 is already on PyPI, skip the upload, and the deployment will go green — same Release tag, no new artifact.
Diff
🤖 Generated with Claude Code